protected void btnAddTopic_Click(object sender, EventArgs e) { obj = new TopicMaster(); obj.Name = txtName.Text; obj.Description = txtDescription.Text; obj.SubjectID = Convert.ToInt16(ddlSubject.SelectedValue); //obj.IsVisible = chkVisible.Checked; obj.CreatedBy = 1; obj.UpdatedBy = 1; obj.TopicID = Convert.ToInt16(lblTopicID.Text); if (lblTopicID.Text.Equals("-1")) { obj1 = new TopicMasterDataManager(); obj1.AddTopicDetail(obj); msgbox("Topic Added successfully!!!"); } else { obj1 = new TopicMasterDataManager(); obj1.UpdateTopicDetail(obj); msgbox("Topic updated successfully!!!"); } Clear(); BindDropdown(); bind(ddlSubject.SelectedValue); }
public HttpResponseMessage Put([FromBody] TopicMaster topicMaster) { topicMaster.LastModifieddate = DateTime.Now; if (ModelState.IsValid) { _topicMasterRepo.Update(topicMaster); } if (topicMaster.TopicId > 0) { var response = Request.CreateResponse(HttpStatusCode.OK, "Updated Successfully"); return(response); } else { var response = Request.CreateResponse(HttpStatusCode.NotAcceptable, "Error Occured", Configuration.Formatters.JsonFormatter); return(response); } }
//[Authorize(Roles = "Admin")] public ActionResult TopicMaster(TopicMaster TopicMaster) { UserViewModel userDetails = generic.GetUserDetail(User.Identity.GetUserId()); TopicMaster.SubscriberId = userDetails.SubscriberId; if (string.IsNullOrEmpty(TopicMaster.TopicId)) { TopicMaster.TopicId = lms.GetTopicId(); } if (string.IsNullOrEmpty(TopicMaster.SubscriberId)) { return(RedirectToAction("Login", "Account", new { area = "" })); } else { bool result = lms.AddTopicMaster(TopicMaster.TopicId, TopicMaster.TopicName, TopicMaster.TopicDescription, TopicMaster.SubscriberId); return(RedirectToAction("TopicMaster", "Course", new { area = "LMS", status = result })); } }
public void AddTopicDetail(TopicMaster obj) { try { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@SubjectID", obj.SubjectID), new SqlParameter("@Name", obj.Name), // new SqlParameter("@IsVisible",obj.IsVisible.Equals(true)?1:0), new SqlParameter("@Description", obj.Description), new SqlParameter("@CreatedBy", obj.CreatedBy), new SqlParameter("@UpdatedBy", obj.UpdatedBy) }; DBOperate.ExecuteProcedureWithOutReturn("usp_AddTopic", parameter); } catch { throw; } }