I am a newbie learning entity framework ( VS2012) and writing a simple CRUD application for testing. I have created the following function for a simple insert / update. I want to know if its ok or have any flaws and can be improved?
This function will be in a class library class file and will be called from the web UI on form submission.
Here is the function :
public static bool Save(int id, string hospitalname, string hospitaladdress, int cityid,
                            string postcode, int countryid, string email, string     phone, string fax, string contactperson,
                            string otherdetails, bool isactive, DateTime createddate)
    {
        bool flag = false;
        using (var dataContext = new pacsEntities())
        {
            if (id == 0)
            {
                // insert
                var newhospital = new hospital_master();
                newhospital.hospitalname = hospitalname;
                newhospital.hospitaladdress = hospitaladdress;
                newhospital.cityid = cityid;
                newhospital.postcode = postcode;
                newhospital.countryid = countryid;
                newhospital.email = email;
                newhospital.phone = phone;
                newhospital.fax = fax;
                newhospital.contactperson = contactperson;
                newhospital.otherdetails = otherdetails;
                newhospital.isactive = isactive;
                newhospital.createddate = DateTime.Now;
                dataContext.hospital_master.AddObject(newhospital);
                dataContext.SaveChanges();
                flag = true;
            }
            else
            {
                // update
                var hospital = dataContext.hospital_master.First(c => c.hospitalid == id);
                if (hospital != null)
                {
                    hospital.hospitalname = hospitalname;
                    hospital.hospitaladdress = hospitaladdress;
                    hospital.cityid = cityid;
                    hospital.postcode = postcode;
                    hospital.countryid = countryid;
                    hospital.email = email;
                    hospital.phone = phone;
                    hospital.fax = fax;
                    hospital.contactperson = contactperson;
                    hospital.otherdetails = otherdetails;
                    hospital.isactive = isactive;
                    dataContext.SaveChanges();
                    flag = true;
                }
            }
        }
        return flag;
    }
 
     
    