/// <summary> /// Written: 02/12/2013 /// </summary> /// <param name="repeatTypeName"></param> /// <param name="repeatTypeDescription"></param> /// <returns></returns> public int CreateNewRepeat(string repeatTypeName, string repeatTypeDescription) { var repeatTypeId = RepeatTypesIdGeneration(); if (repeatTypeId == 0) { return 0; } var newRepeatType = new RepeatType() { RepeatTypeId = repeatTypeId, RepeatTypeName = repeatTypeName, RepeatDescription = repeatTypeDescription, CreateDate = DateTime.Now }; db.RepeatTypes.Add(newRepeatType); db.SaveChanges(); return repeatTypeId; }
/// <summary> ///New repeat type created /// </summary> /// <param name="repeatTypeName"></param> /// <param name="repeatTypeDescription"></param> /// <returns></returns> public int CreateNewRepeat(string repeatTypeName, string repeatTypeDescription) { //New repeat type id generated var repeatTypeId = RepeatTypesIdGeneration(); //id generation failed 0 returned if (repeatTypeId == 0) { return 0; } //new repeat type object created var newRepeatType = new RepeatType { RepeatTypeId = repeatTypeId, RepeatTypeName = repeatTypeName, RepeatDescription = repeatTypeDescription, CreateDate = DateTime.Now }; //repeat type added to database _dBase.RepeatTypes.Add(newRepeatType); _dBase.SaveChanges(); //id returned return repeatTypeId; }